home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir42 / a2z.zip / A2ZCOMP.HLP < prev    next >
Text File  |  1993-11-15  |  18KB  |  720 lines

  1.                           ░░░▒  ░░▒  ░░░░░▒ ░░░░▒
  2.                          ░▒    ░▒ ░▒ ░▒░▒░▒ ░▒ ░▒
  3.                         ░▒     ░▒ ░▒ ░▒░▒░▒ ░░░░▒
  4.                          ░▒    ░▒ ░▒ ░▒  ░▒ ░▒
  5.                           ░░░▒  ░░▒  ░▒  ░▒ ░▒
  6.  
  7.                                  Compiler
  8.  
  9.          (E)dit or (C)ompile or (S)how or (P)rint or (M)ap or (D)elete or Esc  E
  10.  
  11.          (E)dit loads MACRO EDITOR
  12.  
  13.          (C)ompile COMPILES edited macro
  14.  
  15.          (S)how lists existing macro code on SCREEN
  16.  
  17.          (M)ap lists executable macro on PRINTER
  18.  
  19.          (P)rint lists existing macro code on PRINTER
  20.  
  21.          (D)elete ERASES executable macro
  22.  
  23.          Esc EXITS from compiler
  24.          ╔═════════════════════╗
  25.          ║      Macro Editor   ║
  26.          ╚═════════════════════╝
  27.  
  28.  
  29.      SAMPLE.COD    Line:1  Column:1  Page:1  :1-120 :1-264
  30.      ===> _<--hit ENTER to move to TEXT body   (enter HELP for help...
  31.           ┌───────────────────────────────────────────────────────────┐-----
  32.      00001│    |key = concat(last,@,first,@,mid)                      │     |
  33.      00004│    |                                                      │     |
  34.      00002│    |hit HOME to return to command line ===>               │     |
  35.      00003│    |then enter RUN to compile macro                       │     |
  36.      00005│    |                                                      │     |
  37.      00006│    |                                                      │     |
  38.      00007│    |                                                      │     |
  39.      00008│    |                                                      │     |
  40.      00009│    |                                                      │     |
  41.      00010│    |                          auto view change at col 73 >│120 >|
  42.      00011│    |                                                      │     |
  43.      00012│    |                                                      │     |
  44.      00013│    |  auto screen and page advance                        │     |
  45.      00014│    |  v                                                   │     |
  46.           └───────────────────────────────────────────────────────────┘-----
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.             ■  STATEMENT LINE can be free-form
  56.  
  57.             ■  KEYNAMES and OPERATORS must be separated by at LEAST 1 SPACE
  58.  
  59.             ■  CHARACTER constants should be enclosed by QUOTES
  60.  
  61.             ■  CHARACTER constants containing blanks MUST be enclosed by QUOTES
  62.  
  63.             ■  CODE can be in UPPER, LOWER, or CAPS case
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  Operand 1                     Operator   Operand 2
  73.  
  74.  LINK KEY[DRIVE:FILE]             =       WRITE
  75.  KEY                              <>      KEY[DRIVE:FILE]
  76.  STRING(KEY,POS,LEN)              >       STRING(KEY,POS,LEN)
  77.  STRING(KEY[DRIVE:FILE],POS,LEN)  <=      STRING(KEY[DRIVE:FILE],POS,LEN)
  78.  IF KEY                           >=      NUMERIC VALUE
  79.  ELSE                             <=      'CHARACTER STRING'
  80.  ENDIF                            EQ      BLANK
  81.  ABORT                            NE      LOWER
  82.                                   GT      UPPER
  83.                                   LT      CAPS
  84.                                   GE      LAST(KEY)
  85.                                   LE      CONCAT(KEY,KEY)
  86.                                           PARSE(KEY)
  87.                                           SYSTIME              Operand 3
  88.                                           SYSDATE
  89.                                           SYSDMIL              1-9R
  90.                                           +                    1-9T
  91.                                           -                    AND
  92.                                           *                    OR
  93.                                           /                    THEN
  94.  
  95.  
  96.                              Macro Example:
  97.  
  98.                 . . . . IF RECORD STATUS = BLANK THEN
  99.                 .        MAX QTY = 0
  100.                 .        LINK REC[C:LA] = REC
  101.                 .   . . . LA QTY = LA QTY[C:LA]
  102.                 .   .     IF LA QTY > MAX QTY THEN
  103.                 .   .      MAX QTY = LA QTY
  104.                 .   .      LOC = LA
  105.                 .   . . . ENDIF
  106.                 .        LINK REC[C:KC] = REC
  107.                 .         KC QTY = KC QTY[C:KC]
  108.                 .   . . . IF KC QTY > MAX QTY THEN
  109.                 .   .      MAX QTY = KC QTY
  110.                 .   .      LOC = KC
  111.                 .   . . . ENDIF
  112.                 .        LINK REC[C:NY] = REC
  113.                 .         NY QTY = NY QTY[C:NY]
  114.                 .   . . . IF NY QTY > MAX QTY THEN
  115.                 .   .      MAX QTY = NY QTY
  116.                 .   .      LOC = NY
  117.                 .   . . . ENDIF
  118.                 .        TOT QTY = LA QTY + KC QTY + NY QTY
  119.                 . . . . ENDIF
  120.  
  121.  
  122.  
  123.                                   LINK Rules
  124.  
  125.  
  126.  
  127.                Format:     keyname[drive:file] = keyname
  128.                               ^                     ^
  129.                              LINK                ROOT ARG
  130.  
  131.  
  132.                            keyname[drive:file] = constant
  133.                               ^                     ^
  134.                              LINK                LINK ARG
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.                              LINK REC[C:SALE] = REC
  148.  
  149.                                 One to One LINK
  150.  
  151.                      ┌──────────┐            ┌──────────┐
  152.                      │Rec 1     │<───LINK───>│Rec 1     │
  153.                      └──────────┘            └──────────┘
  154.                      ┌──────────┐            ┌──────────┐
  155.                      │Rec 2     │<───LINK───>│Rec 2     │
  156.                      └──────────┘            └──────────┘
  157.                          ROOT                    LINK
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.                              LINK REC[C:SALE] = WRITE
  172.  
  173.                                 One to One LINK
  174.  
  175.                      ┌──────────┐            ┌──────────┐
  176.                      │Rec 1     │<───LINK───>│ Created  │
  177.                      └──────────┘            └──────────┘
  178.                      ┌──────────┐            ┌──────────┐
  179.                      │Rec 2     │<───LINK───>│ Created  │
  180.                      └──────────┘            └──────────┘
  181.                          ROOT                    LINK
  182.  
  183.  
  184.            ╔══════════════════════════════════════════════════════╗
  185.            ║  A link to a target data base with a search argument ║
  186.            ║  of 'WRITE' will create an new OUTPUT RECORD         ║
  187.            ╚══════════════════════════════════════════════════════╝
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                              LINK EMPL[C:PERS] = EMPL
  196.  
  197.                                 One to One LINK
  198.  
  199.                      ┌──────────┐            ┌──────────┐
  200.                      │Empl 1    │<─LINK──┐ ┌>│ Empl 2   │
  201.                      └──────────┘       ┌│─┘ └──────────┘
  202.                      ┌──────────┐       ││   ┌──────────┐
  203.                      │Empl 2    │<─LINK─┘└──>│ Empl 1   │
  204.                      └──────────┘            └──────────┘
  205.                          ROOT                    LINK
  206.  
  207.                 the LINK record is LINKed by looking for a match
  208.                 based on the ROOT argument.  Either file may be indexed.
  209.                 A non-indexed LINK file will be searched sequentially.
  210.                 An indexed LINK file will be binary searched
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.                              LINK REC[C:LETR] = 1
  220.  
  221.                                 One to Many
  222.  
  223.                      ┌──────────┐            ┌──────────┐
  224.                      │Rec 1     │<───LINK────│Rec 1     │
  225.                      └──────────┘         │  └──────────┘
  226.                      ┌──────────┐         │
  227.                      │Rec 2     │<───LINK─┘
  228.                      └──────────┘
  229.                          ROOT                    LINK
  230.  
  231.  
  232.                 for each ROOT record, REC 1 is LINKed
  233.  
  234.                 can be used to propagate data from one file to
  235.                 many files, for example, copying a form letter
  236.                 from one record and merging it with each empl-
  237.                 oyee record to create a mail-merged letter
  238.  
  239.  
  240.  
  241.  
  242.  
  243.                              LINK REC[C:1988] = 1
  244.  
  245.                                 Many to One
  246.  
  247.                      ┌──────────┐            ┌──────────┐
  248.                      │Rec 1     │────LINK───>│Rec 1     │
  249.                      └──────────┘         │  └──────────┘
  250.                      ┌──────────┐         │
  251.                      │Rec 2     │────LINK─┘
  252.                      └──────────┘
  253.                          ROOT                    LINK
  254.  
  255.  
  256.                 REC 1 is updated by each ROOT record
  257.  
  258.                 can be used to accumulate data from many records
  259.                 to one record, for example, creating a statistics
  260.                 record by accumulating data from each ROOT record
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.        Compiler automatically prevents EXECUTION of statements UP TO
  269.        the NEXT LINK statement or END OF MACRO if a RECORD LINKED = N
  270.        condition is detected in the ROOT record
  271.  
  272.  
  273.         . . LINK ZIP[C:ZIP] = ZIP
  274.         .     CITY = CITY[C:ZIP]
  275.         .     STATE = STATE[C:STATE]
  276.         . . LINK REC[C:LAB] = WRITE
  277.               L1[C:LAB] = CONCAT(CITY,@,STATE)
  278.  
  279.  
  280.        if a MATCH ON ZIP is not found, then RECORD LINKED = N and
  281.        the CITY and STATE move statements will NOT be executed,
  282.        however, the remaining code will be EXECUTED
  283.  
  284.  
  285.  
  286.  
  287.  
  288.        to PREVENT ALL EXECUTION following the RECORD LINKED = N
  289.        condition, code the following:
  290.  
  291.             LINK ZIP[C:ZIP] = ZIP
  292.         . . IF RECORD LINKED = Y THEN
  293.         .     CITY = CITY[C:ZIP]
  294.         .     STATE = STATE[C:STATE]
  295.         .   LINK REC[C:LAB] = WRITE
  296.         .     L1[C:LAB] = CONCAT(CITY,@,STATE)
  297.         . . ENDIF
  298.  
  299.        to CAUSE an IMMEDIATE ABORT following the RECORD LINKED = N
  300.        condition, code the following:
  301.  
  302.             LINK ZIP[C:ZIP] = ZIP
  303.             IF RECORD LINKED = N THEN
  304.         . . . ABORT
  305.         .     CITY = CITY[C:ZIP]
  306.         .     STATE = STATE[C:STATE]
  307.         .   LINK REC[C:LAB] = WRITE
  308.         .     L1[C:LAB] = CONCAT(CITY,@,STATE)
  309.         .
  310.         v
  311.        EXIT
  312.  
  313.                            CONSTANT to KEY MOVE
  314.  
  315.                ■  TARGET field is on left side of '=' OPERATOR
  316.  
  317.                ■  SOURCE field is on right side of '=' OPERATOR
  318.  
  319.                ■  TARGET must be a valid KEYNAME
  320.  
  321.                ■  SOURCE may be a NUMERIC or CHARACTER constant
  322.  
  323.                ■  CHARACTER constants should be enclosed by QUOTES
  324.  
  325.                ■  CHARACTER constants longer than TARGET field are TRUNCATED
  326.  
  327.                ■  CHARACTER data MAY NOT be moved to a NUMERIC field
  328.  
  329.                ■  NUMERIC constants may contain imbedded decimal point
  330.  
  331.  
  332.                   Examples:   NAME = 'BLOW JOE A'
  333.                               RATE = 9.50
  334.  
  335.  
  336.  
  337.                                KEY to KEY MOVE
  338.  
  339.                ■  TARGET field is on left side of '=' OPERATOR
  340.  
  341.                ■  SOURCE field is on right side of '=' OPERATOR
  342.  
  343.                ■  TARGET must be a valid KEYNAME
  344.  
  345.                ■  SOURCE must be a valid KEYNAME
  346.  
  347.  
  348.                   Example:   VALU = SALES
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.                                  KEY CALCULATION
  361.  
  362.                ■  TARGET field is on left side of '=' OPERATOR
  363.  
  364.                ■  SOURCE field(s) on right side of '=' OPERATOR
  365.  
  366.                ■  TARGET must be a valid KEYNAME
  367.  
  368.                ■  SOURCE can be a valid KEYNAME or a CONSTANT
  369.  
  370.                ■  CONSTANTS may be NUMERIC only
  371.  
  372.                ■  TARGET field may also be a SOURCE field in a
  373.                   calculation    for example:   VALU = VALU + 1
  374.  
  375.                ■  NUMERIC constants may contain imbedded decimal point
  376.  
  377.                ■  ALL calculations are based on WHOLE NUMBERS
  378.  
  379.                ■  TRUNCATION and ROUNDING OPERATORS resolve DECIMAL PLACEMENT
  380.  
  381.                       R = Round             1-9  Decimal Places
  382.                       T = Truncate          1-9  Decimal Places
  383.  
  384.  
  385.  
  386.                       TOTAL = SALE * 1.06 2R
  387.  
  388.                       contents of SALE is 1000
  389.                       1000 * 106 equals calculated value: 106000
  390.                       2R rounds 106000 2 decimal places
  391.                       value of 1060 is stored into TOTAL
  392.  
  393.  
  394.                ■  SOURCE CALCULATION is from LEFT to RIGHT
  395.  
  396.                       PROFIT = SALE - COST + EXPENSE
  397.  
  398.                       would produce INVALID results
  399.  
  400.  
  401.                       WORK = COST + EXPENSE
  402.                       PROFIT = SALE - WORK
  403.  
  404.                       CORRECT technique
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.                              STRING MOVE
  412.  
  413.  
  414.                Format:     STRING(keyname,pos,len)
  415.  
  416.  
  417.                ■  STRING field can be TARGET or SOURCE
  418.  
  419.                ■  POS+LEN longer than TARGET field will be TRUNCATED
  420.  
  421.                ■  CHARACTER data MAY NOT be moved to a NUMERIC
  422.                   field
  423.  
  424.                   Examples:   STRING(DATA,2,3) = S3
  425.                               STRING(DATA[B:LINK],2,3) = XXX
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.                              BLANK MOVE
  436.  
  437.  
  438.                Format:     KEY = BLANK
  439.  
  440.  
  441.                ■  TARGET can be CHARACTER or NUMERIC field
  442.  
  443.                ■  causes entire TARGET field to be blanked
  444.  
  445.                   Examples:   NAME = BLANK
  446.                               VALU = BLANK
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.                              LOWER TRANSLATE
  460.  
  461.  
  462.                Format:     KEY = LOWER
  463.  
  464.  
  465.                ■  TARGET can be CHARACTER field only
  466.  
  467.                ■  causes TARGET field to be translated to LOWERCASE
  468.  
  469.                   Example:   NAME = LOWER
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.                              UPPER TRANSLATE
  484.  
  485.  
  486.                Format:     KEY = UPPER
  487.  
  488.  
  489.                ■  TARGET can be CHARACTER field only
  490.  
  491.                ■  causes TARGET field to be translated to UPPERCASE
  492.  
  493.                   Example:   NAME = UPPER
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.                              CAPS TRANSLATE
  508.  
  509.  
  510.                Format:     KEY = CAPS
  511.  
  512.  
  513.                ■  TARGET can be CHARACTER field only
  514.  
  515.                ■  causes FIRST letter of each word in TARGET
  516.                   field to be translated to UPPERCASE and
  517.                   remaining letters to LOWERCASE
  518.  
  519.                   Example:   NAME = CAPS
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.                              MOVE LAST
  532.  
  533.  
  534.                Format:     KEY = LAST(KEY)
  535.  
  536.  
  537.                ■  TARGET can be CHARACTER or NUMERIC field
  538.  
  539.                ■  moves FIELD of LAST RECORD to TARGET
  540.  
  541.                ■  can be used in FILE to DUPLICATE common data
  542.  
  543.  
  544.                   Example:   NAME = LAST(NAME)
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.                              CONCAT MOVE
  556.  
  557.  
  558.                Format:     KEY = CONCAT(KEY,KEY,KEY)
  559.  
  560.  
  561.                ■  TARGET can be CHARACTER field only
  562.  
  563.                ■  SOURCE is a LIST of 1-7 fields
  564.  
  565.                ■  SOURCE can be CHARACTER or NUMERIC
  566.  
  567.                ■  CHARACTER fields are stripped of trailing BLANKS
  568.  
  569.                ■  NUMERIC fields are stripped of leading ZEROS
  570.  
  571.                ■  @  (1-9) inserts a BLANK(s) into CONCAT field
  572.  
  573.  
  574.                   Example:   NAME = CONCAT(FIRST,@,MIDDLE,@,LAST)
  575.  
  576.  
  577.  
  578.  
  579.                              PARSE MOVE
  580.  
  581.  
  582.                Format:     KEY = PARSE(KEY)
  583.  
  584.  
  585.                ■  TARGET can be CHARACTER field only
  586.  
  587.                ■  SOURCE can be CHARACTER field only
  588.  
  589.                ■  SOURCE can be CHARACTER or NUMERIC
  590.  
  591.                ■  FIRST word of SOURCE field is trimmed of leading BLANKS
  592.  
  593.                ■  FIRST word of SOURCE field is moved to TARGET field
  594.  
  595.                ■  SOURCE field contains remaining words after PARSE
  596.  
  597.  
  598.                   Example:   FIRST = PARSE(NAME)
  599.  
  600.  
  601.  
  602.  
  603.                              SYSTIME MOVE
  604.  
  605.  
  606.                Format:     KEY = SYSTIME
  607.  
  608.  
  609.                ■  SYSTIME TARGET should be TYP=C LEN=08
  610.  
  611.                ■  SYSTIME is in format '10:25 AM'
  612.  
  613.  
  614.                   Example:   TIME = SYSTIME
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.                              SYSDATE MOVE
  628.  
  629.  
  630.                Format:     KEY = SYSDATE
  631.  
  632.  
  633.                ■  SYSDATE TARGET should be TYP=C LEN=16
  634.  
  635.                ■  SYSDATE is in format '891228 THURSDAY'
  636.  
  637.  
  638.                   Example:   DATE = SYSDATE
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.                              SYSDMIL MOVE
  652.  
  653.  
  654.                Format:     KEY = SYSDMIL
  655.  
  656.  
  657.                ■  SYSDMIL TARGET should be TYP=C LEN=21
  658.  
  659.                ■  SYSDMIL is in format '28 DEC 1989 THURSDAY'
  660.  
  661.  
  662.                   Example:   DMIL = SYSDMIL
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.                              IF STATEMENT
  676.  
  677.  
  678.                Format:     IF KEY = argument THEN
  679.                                              AND
  680.                                              OR
  681.                ■  KEY can be STRING key
  682.  
  683.                ■  KEY can be LINKED or UNLINKED
  684.  
  685.                ■  argument can be KEY or CONSTANT
  686.  
  687.                ■  argument KEY can be LINKED or UNLINKED
  688.  
  689.                ■  IF must be ENDED by ENDIF
  690.  
  691.  
  692.                   Examples:   IF REC = 23 THEN
  693.                                A = B
  694.                               ENDIF
  695.  
  696.  
  697.                               IF LAST = BLOW AND
  698.                               IF FIRST = JOE THEN
  699.                                A = B
  700.                               ENDIF
  701.  
  702.  
  703.                               IF RECIPE = COOKIE OR
  704.                               IF RECIPE = CAKE THEN
  705.                                A = B
  706.                               ELSE
  707.                                A = C
  708.                               ENDIF
  709.  
  710.  
  711.                               IF REC = 1 THEN
  712.                                 A = B
  713.                               ELSE
  714.                               IF REC = 2 THEN
  715.                                 A = C
  716.                               ELSE
  717.                               IF REC = 3 THEN
  718.                                 A = D
  719.                               ENDIF
  720.